<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <#include "../common/header.ftl"/>

    <script>
        $(function () {
            //修改 推荐
            $(".inputBtn").click(function () {
                //清除模态框数据
                $("#editForm input").val("");
                $("#coverUrl").attr("src","");//清除封面
                //获取关联游记信息
                var json = $(this).data("json");
                console.log(json);
                //回显
                $("#editForm input[name='id']").val(json.id);//id
                $("#editForm a").attr('href','/travel/releaseList.do?travelId='+json.travelId);
                $("#editForm input[name='title']").val(json.title);//标题
                $("#editForm input[name='subTitle']").val(json.subTitle);//副标题
                $("#editForm input[name='coverUrl']").val(json.coverUrl);//封面
                $("#coverUrl").attr("src",json.coverUrl);//显示封面
                $("#editForm input[name='schedule']").val(json.schedule);//推荐时间
                //展现模态框
                $("#hotModal").modal("show");





                //保存按钮
                $("#editForm").ajaxForm(function (data) {
                    reload();
                })
                $(".btn-submit").click(function () {
                    $("#editForm").submit();
                });




            });








        });
    </script>


</head>
<body>

<div class="container " style="margin-top: 20px">
   <#include "../common/top.ftl"/>
    <div class="row">
        <div class="col-sm-3">
            <#assign currentMenu="travelCommend"/>
            <#include "../common/menu.ftl"/>
        </div>
        <div class="col-sm-9">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">待审核游记列表</h1>
                </div>
            </div>
            <!--高级查询--->
            <form class="form-inline" id="searchForm" action="/travelCommend/list.do" method="post">
                <input type="hidden" name="currentPage" id="currentPage" value="1">
                <div class="form-group">
                    <label>推荐类型:</label>
                    <select id="selectState" class="form-control" name="state">
                        <option value="-1">全部</option>
                        <option value="1">每周推荐</option>
                        <option value="2">每月推荐</option>
                        <option value="3">攻略推荐</option>
                    </select>
                    <#--回显-->
                    <script>
                        $("#selectState").val(${(qo.type)!});
                    </script>
                </div>
                <button id="btn_query" class="btn btn-primary">
                    <span class="glyphicon glyphicon-search"></span> 查询
                </button>
            </form>
            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>封面</th>
                    <th>标题</th>
                    <th>副标题</th>
                    <th>推荐时间安排</th>
                    <th>推荐类型</th>
                </tr>

                </thead>
                <#list pageInfo.list as entity>
                    <tr>
                        <td>${entity_index+1}</td>
                        <td><img src="${entity.coverUrl}" style="width: 30px"/></td>
                        <td>${entity.title}</td>
                        <td>${entity.subTitle}</td>
                        <td>${(entity.schedule)?string("yyyy-MM-dd")!}</td>
                        <td>${entity.typeName}</td>
                        <td>
                            <a class="btn btn-info btn-xs btn-input inputBtn" data-json='${entity.json}' >
                                <span class="glyphicon glyphicon-pencil"></span>修改
                            </a>
                        </td>


                    </tr>
                </#list>
            </table>
           <#include "../common/page.ftl"/>
        </div>
    </div>
</div>


<!-- 推荐的模态框（Modal） -->

<div class="modal fade" id="hotModal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">新增游记推荐</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="/travelCommend/saveOrUpdate.do" method="post" id="editForm" enctype="multipart/form-data">
                    <input type="hidden" name="id" >
                    <div class="form-group">
                        <label for="name" class="col-sm-4 control-label">标题：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="title" name="title" >
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="name" class="col-sm-4 control-label">副标题：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="subTitle" name="subTitle" >
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="sn" class="col-sm-4 control-label">封面：</label>
                        <div class="col-sm-6">
                            <img id="coverUrl" width="100%"/>
                            <input type="file" class="form-control" name="file" >
                            <input type="hidden" class="form-control" name="coverUrl" >
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="sn" class="col-sm-4 control-label">推荐时间：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="schedule" name="schedule" onclick="WdatePicker()" >
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="sn" class="col-sm-4 control-label">推荐类型：</label>
                        <div class="col-sm-6">
                            <select id="auditState" class="form-control" autocomplete="off" name="type" >
                                <option value="1">每周推荐</option>
                                <option value="2">每月推荐</option>
                                <option value="3">攻略推荐</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" style="text-align: center">
                        <a target="_blank">查看文章明细</a>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary btn-submit">保存</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->



</body>

</html>